import { dateFormat } from '@/util/date';
export const startDate = dateFormat(new Date(), 'yyyy-MM-') + '01';
let now = new Date();
now.setDate(now.getDate() + 1);
export const endDate = dateFormat(now, 'yyyy-MM-dd');
export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  dialogWidth: '70%',
  printBtn: false,
  editBtn: false,
  addBtn: false,
  delBtn: false,
  viewBtn: true,
  searchSize: 'mini',
  labelWidth: 130,
  //menuWidth: 100,
  searchMenuSpan: 6,
  selection: true,
  column: [{
    label: '标识',
    prop: 'id',
    hide: true,
    display: false
  }, {
    label: '出库单号',
    prop: 'outstockno',
    search: true,
    display: false
  }, {
    label: '出库类型',
    prop: 'outGoingType',
    search: true,
    type: 'select',
    dicUrl: '/admin/dict/type/inventory_out_type',
    display: false
  },{
    label: '票种',
    prop: 'ticketType',
    search: true,
    type: 'select',
    dicUrl: '/support/swpmticketcardtype/dict',
    props: {
      label: 'mainName',
      value: 'mainEnName'
    },
    cascaderItem: ["ticketName"],
    display: false
  },{
    label: '车票名称',
    prop: 'ticketName',
    search: true,
    type: 'select',
    props: {
      label: 'subName',
      value: 'subEnName'
    },
    dicUrl: '/support/swpmticketcardtypeparam/dictAll/{{key}}',
    dicFlag: false,
    display: false
  },  {
    label: '审批状态',
    prop: 'checkApproveStatus',
    type: 'select',
    search: true,
    dicUrl: '/admin/dict/type/check_approve_status',
    display: false
  },
  {
      label: '出库时间',
      prop:'outGoingTime',
      type: 'datetime',
      search: true,
      searchRange: true,
      searchSpan: 12,
      format: "yyyy-MM-dd",
      valueFormat: "yyyy-MM-dd",
      searchValue: [startDate, endDate],
    },
  {
    label: '车票次数',
    prop: 'ticketTimes',
    display: false
  }, {
    label: '车票金额',
    prop: 'ticketPrice',
	type: 'number',
	precision: 2,
    display: false
  }, {
    label: '车票数量',
    prop: 'ticketNumber',
    type: 'number',
    precision: 0,
    display: false
  }, {
    label: '库区分区',
    prop: 'stockArea',
    type: 'select',
    search: true,
    dicUrl: '/support/swpmticketarea/dictCustom',
    props: {
      label: "ticketAreaName",
      value: "id"
    },
    display: false
  }, {
    label: '车票有效期',
    prop: 'activeTime',
    type: 'input',
    //precision: 0,
    display: false
  }, {
    label: '车票最晚使用时间',
    prop: 'latestStartTime',
    type: 'date',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd HH:mm:ss',
    display: false,
  }, {
    label: '是否领取',
    prop: 'isreceive',
    display: false
  }, {
    label: '库管1',
    prop: 'keeper1name',
    type: "select",
    component: "user-select",
    params: {
      userCodeKey: "keeper1code"
    },
    dicFlag: false,
    dicQuery: {
      belongToLine: true
    },
    search: true,
    display: false
  }, {
    label: '库管1工号',
    prop: 'keeper1code',
    display: false
  }, {
    label: '库管2',
    prop: 'keeper2name',
    type: "select",
    component: "user-select",
    params: {
      userCodeKey: "keeper2code"
    },
    dicFlag: false,
    dicQuery: {
      belongToLine: true
    },
    search: true,
    display: false
  }, {
    label: '库管2工号',
    prop: 'keeper2code',
    display: false
  }, {
    label: '起号/止号',
    prop: 'ticketNo',
    type: 'textarea',
    display: false
  },{
    label: "数据来源",
    prop: "dataSource",
    type: "select",
    search: true,
    dicUrl: "/admin/dict/type/dataSource_status",
    display: false
  }, {
    label: '备注',
    prop: 'remark',
    type: 'textarea',
    hide: true,
    display: false
  }, {
    label: '创建人ID',
    prop: 'creatorId',
    hide: true,
    display: false
  }, {
    label: '创建人名称',
    prop: 'creatorName',
    hide: true,
    display: false
  }, {
    label: '创建时间',
    prop: 'createtime',
    hide: true,
    display: false
  }],
  group: [{
    column: [{
      label: '箱子流水号',
      prop: 'boxNo',
      formslot: true,
      editDisplay: false,
      viewDisplay: false
    }]
  }, {
    label: '出库信息摘要',
    column: [{
      label: '出库单号',
      prop: 'outstockno',
      addDisplay: false,
      disabled: true
    }, {
      label: "出库人工号",
      prop: "keepercode",
      type: "select",
      component: "user-select",
      params: {
        prop: "keepercode",
        userCodeKey: "keepername",
        labelKey: "userCode",
        valueKey: "nikename",
        allowCreate: true
      },
      dicQuery: {
        belongToLine: true
      },
    },{
      label: "出库人",
      prop: "keepername",
      rules: [{
        required: true,
        message: '请输入出库人',
        trigger: 'blur'
      }]
    },{
      label: '出库类型',
      prop: 'outGoingType',
      type: 'select',
      dicUrl: '/admin/dict/type/inventory_out_type',
      rules: [{
        required: true,
        message: '请选择出库类型',
        trigger: 'blur'
      }]
    }, {
      label: '出库时间',
      "prop":'outGoingTime',
      type: 'datetime',
      //search: true,
      searchRange: true,
      searchSpan: 12,
      format: 'yyyy-MM-dd HH:mm:ss',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      rules: [{
        required: true,
        message: '请输入出库时间',
        trigger: 'blur'
      }]
    }]
  }, {
    label: '出库明细',
    column: [{
      label: '票种',
      prop: 'ticketType',
      type: 'select',
      dicUrl: '/support/swpmticketcardtype/dict',
      props: {
        label: 'mainName',
        value: 'mainEnName'
      },
      cascaderItem: ["ticketName"],
      rules: [{
        required: true,
        message: '请选择车票种类',
        trigger: 'blur'
      }]
    }, {
      label: '车票名称',
      prop: 'ticketName',
      type: 'select',
      props: {
        label: 'subName',
        value: 'subEnName'
      },
      dicUrl: '/support/swpmticketcardtypeparam/dictAll/{{key}}',
      dicFlag: false,
      rules: [{
        required: true,
        message: '请选择车票名称',
        trigger: 'blur'
      }],
      component: 'ticket-name-select',
      params: {
        ticketAmountKey: 'ticketPrice',
        ticketCountKey: 'ticketTimes'
      }
    }, {
      label: '车票次数',
      prop: 'ticketTimes',
      type: 'number',
      addDisabled: true,
      placeholder: ' '
    }, {
      label: '车票金额',
      prop: 'ticketPrice',
      type: 'number',
      precision: 2,
      addDisabled: true,
      placeholder: ' '
    }, {
      label: '车票数量',
      prop: 'ticketNumber',
      type: 'number',
      precision: 0,
      rules: [{
        required: true,
        message: '请输入车票数量',
        trigger: 'blur'
      }]
    }, {
      label: '库区分区',
      prop: 'stockArea',
      type: 'select',
      dicUrl: '/support/swpmticketarea/dict',
      props: {
        label: "ticketAreaName",
        value: "id"
      },
      rules: [{
        required: true,
        message: '请选择库区分区',
        trigger: 'blur'
      }]
    }, {
      label: '车票有效期',
      prop: 'activeTime',
      type: 'input',
      //precision: 0,
      // rules: [{
      //   required: true,
      //   message: '请输入车票有效期',
      //   trigger: 'blur'
      // }]
    }, {
      label: '车票最晚使用时间',
      prop: 'latestStartTime',
      type: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      rules: [{
        message: '请输入车票最晚使用时间',
        trigger: 'blur'
      }]
    }, {
      label: '库管2',
      prop: 'keeper2name',
      type: 'select',
      component: 'user-select',
      params: {
        userCodeKey: 'keeper2code'
      },
      dicFlag: false,
      dicQuery: {
        belongToLine: true
      },
      rules: [{
        required: true,
        message: '请选择库管2',
        trigger: 'blur'
      }]
    }, {
      label: '库管2工号',
      prop: 'keeper2code',
      disabled: true,
      placeholder: ' '
    }, {
      label: '起号/止号',
      prop: 'ticketNo',
      type: 'textarea',
      maxRows: 6,
      minRows: 4,
      span: 24
    }, {
      label: '上传附件',
      prop: 'filePath',
      type: 'upload',
      component: 'zd-upload',
      dataType: 'string',
      span: 24
    }, {
      label: '上传图片',
      prop: 'picturePath',
      type: 'upload',
      component: 'zd-upload',
      listType: 'picture-img',
      span: 24
    }, {
      label: '备注',
      prop: 'remark',
      type: 'textarea',
      maxRows: 6,
      minRows: 4,
      span: 24
    }]
  }]
};

export const tableOptionAdd = {
  border: true,
  index: true,
  indexLabel: "序号",
  align: "center",
  labelWidth: 130,
  submitBtn:false,
  emptyBtn:false,
  group: [
    {
    column: [{
      label: '箱子流水号',
      prop: 'boxNo',
      formslot: true,
      editDisplay: false,
      viewDisplay: false
    }]
  }, 
  {
    label: '出库信息摘要',
    column: [{
      label: '出库单号',
      prop: 'outstockno',
      addDisplay: false,
      disabled: true
    },{
      label: '出库类型',
      prop: 'outGoingType',
      type: 'select',
      dicUrl: '/admin/dict/type/inventory_out_type',
      rules: [{
        required: true,
        message: '请选择出库类型',
        trigger: 'blur'
      }]
    }, {
      label: '出库时间',
      "prop":'outGoingTime',
      type: 'datetime',
      searchRange: true,
      searchSpan: 12,
      format: 'yyyy-MM-dd HH:mm:ss',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      rules: [{
        required: true,
        message: '请输入出库时间',
        trigger: 'blur'
      }]
    }, {
      label: '库管2',
      prop: 'keeper2name',
      type: 'select',
      component: 'user-select',
      params: {
        userCodeKey: 'keeper2code'
      },
      dicFlag: false,
      dicQuery: {
        belongToLine: true
      },
      rules: [{
        required: true,
        message: '请选择库管2',
        trigger: 'blur'
      }]
    }, {
      label: '库管2工号',
      prop: 'keeper2code',
      disabled: true,
      placeholder: ' '
    }, {
      label: '上传图片',
      prop: 'picturePath',
      type: 'upload',
      component: 'zd-upload',
      listType: 'picture-img'
    },]
  }]
};

export const tableOptionAddDetail = {
  border: true,
  index: true,
  indexLabel: "序号",
  align: "center",
  labelWidth: 130,
  column: [{
    label: '票种',
    prop: 'ticketType',
    type: 'select',
    dicUrl: '/support/swpmticketcardtype/dict',
    props: {
      label: 'mainName',
      value: 'mainEnName'
    },
    cascaderItem: ["ticketName"],
    cell: true,
    width: 150,
    rules: [{
      required: true,
      message: '请选择车票种类',
      trigger: 'blur'
    }]
  }, {
    label: '车票名称',
    prop: 'ticketName',
    type: 'select',
    props: {
      label: 'subName',
      value: 'subEnName'
    },
    dicUrl: '/support/swpmticketcardtypeparam/dictAll/{{key}}',
    dicFlag: false,
    rules: [{
      required: true,
      message: '请选择车票名称',
      trigger: 'blur'
    }],
    component: 'ticket-name-select',
    params: {
      ticketAmountKey: 'ticketPrice',
      ticketCountKey: 'ticketTimes'
    },
    width: 180,
    cell: true
  }, {
    label: '车票次数',
    prop: 'ticketTimes',
    type: 'number',
    addDisabled: true,
    placeholder: ' ',
    width: 130,
    cell: true
  }, {
    label: '车票金额',
    prop: 'ticketPrice',
    type: 'number',
    precision: 2,
    addDisabled: true,
    placeholder: ' ',
    width: 130,
    cell: true
  }, {
    label: '车票数量',
    prop: 'ticketNumber',
    type: 'number',
    precision: 0,
    cell: true,
    width: 130,
    rules: [{
      required: true,
      message: '请输入车票数量',
      trigger: 'blur'
    }]
  }, {
    label: '库区分区',
    prop: 'stockArea',
    type: 'select',
    dicUrl: '/support/swpmticketarea/dict',
    props: {
      label: "ticketAreaName",
      value: "id"
    },
    cell: true,
    width: 160,
    rules: [{
      required: true,
      message: '请选择库区分区',
      trigger: 'blur'
    }]
  }, {
    label: '车票有效期',
    prop: 'activeTime',
    type: 'input',
    //precision: 0,
    width: 160,
    cell: true
  }, {
    label: '车票最晚使用时间',
    prop: 'latestStartTime',
    type: 'date',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd HH:mm:ss',
    cell: true,
    width: 180,
    rules: [{
      message: '请输入车票最晚使用时间',
      trigger: 'blur'
    }]
  }, {
    label: '起号/止号',
    prop: 'ticketNo',
    type: 'input',
    width: 180,
    cell: true
  }, {
    label: "出库人工号",
    prop: "keepercode",
    type: "select",
    component: "user-select",
    params: {
      prop: "keepercode",
      userCodeKey: "keepername",
      labelKey: "userCode",
      valueKey: "nikename",
      allowCreate: true
    },
    dicQuery: {
      belongToLine: true
    },
    width: 160
  },{
    label: "出库人",
    prop: "keepername",
    type: "input", 
    cell: true,	
    rules: [{
      required: true,
      message: '请输入出库人',
      trigger: 'blur'
    }],
    width: 150
  }, {
    label: '上传附件',
    prop: 'filePath',
    type: 'upload',
    component: 'zd-upload',
    dataType: 'string',
    width: 420,
    cell: true
  }, {
    label: '备注',
    prop: 'remark',
    type: 'input',
    width: 200,
    cell: true
  }]
};

export const tableOptionComplete = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  dialogWidth: '70%',
  printBtn: false,
  editBtn: false,
  addBtn: false,
  delBtn: false,
  viewBtn: true,
  labelWidth: 130,
  //menuWidth: 100,
  submitBtn: false,
  emptyBtn: false,
  group: [{
    label: '出库明细',
    column: [{
      label: '库区分区',
      prop: 'stockArea',
      type: 'select',
      dicUrl: '/support/swpmticketarea/dict',
      props: {
        label: "ticketAreaName",
        value: "id"
      },
      disabled: false,
      rules: [{
        required: true,
        message: '请选择库区分区',
        trigger: 'blur'
      }]
    }, {
      label: '车票最晚使用时间',
      prop: 'latestStartTime',
      type: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      rules: [{
        message: '请输入车票最晚使用时间',
        trigger: 'blur'
      }]
    },  {
      label: '库管1',
      prop: 'keeper1name',
      type: 'select',
      component: 'user-select',
      params: {
        userCodeKey: 'keeper1code'
      },
      dicFlag: false,
      dicQuery: {
        belongToLine: true
      },
      rules: [{
        required: true,
        message: '请选择库管1',
        trigger: 'blur'
      }]
    }, {
      label: '库管1工号',
      prop: 'keeper1code',
      disabled: true,
      placeholder: ' '
    },{
      label: '库管2',
      prop: 'keeper2name',
      type: 'select',
      component: 'user-select',
      params: {
        userCodeKey: 'keeper2code'
      },
      dicFlag: false,
      dicQuery: {
        belongToLine: true
      },
      rules: [{
        required: true,
        message: '请选择库管2',
        trigger: 'blur'
      }]
    }, {
      label: '库管2工号',
      prop: 'keeper2code',
      disabled: true,
      placeholder: ' '
    }, {
      label: '起号/止号',
      prop: 'ticketNo',
      type: 'textarea',
      maxRows: 6,
      minRows: 4,
      span: 24
    }]
  }]
};

export const tableOptionBatchComplete = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  dialogWidth: '70%',
  printBtn: false,
  editBtn: false,
  addBtn: false,
  delBtn: false,
  viewBtn: true,
  labelWidth: 140,
  //menuWidth: 100,
  submitBtn: false,
  emptyBtn: false,
  group: [{
    label: '出库明细',
    column: [{
      label: '库区分区',
      prop: 'stockArea',
      type: 'select',
      dicUrl: '/support/swpmticketarea/dict',
      props: {
        label: "ticketAreaName",
        value: "id"
      },
      rules: [{
        required: true,
        message: '请选择库区分区',
        trigger: 'blur'
      }]
    }, {
      label: '车票最晚使用时间',
      prop: 'latestStartTime',
      type: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      rules: [{
        message: '请输入车票最晚使用时间',
        trigger: 'blur'
      }]
    },{
      label: '库管2',
      prop: 'keeper2name',
      type: 'select',
      component: 'user-select',
      params: {
        userCodeKey: 'keeper2code'
      },
      dicFlag: false,
      dicQuery: {
        belongToLine: true
      },
      rules: [{
        required: true,
        message: '请选择库管2',
        trigger: 'blur'
      }]
    }, {
      label: '库管2工号',
      prop: 'keeper2code',
      disabled: true,
      placeholder: ' '
    }]
  }]
};